1 00:00:00,600 --> 00:00:04,200 Hello and welcome to this feat you in this video. 2 00:00:04,200 --> 00:00:13,720 I'm going to illustrate how the concert keyword work cost is a shot from for constant. 3 00:00:14,020 --> 00:00:23,040 It's another way you can use to declare variables rather than use the key word you can use konst to 4 00:00:23,070 --> 00:00:29,010 declare your variables is declared is only a concept. 5 00:00:29,130 --> 00:00:34,180 Key word should not be re assigned. 6 00:00:34,260 --> 00:00:35,200 So each time. 7 00:00:35,200 --> 00:00:45,090 Years of cons key word to create variables they will be variables that you don't expect to reassign. 8 00:00:45,090 --> 00:00:47,990 So I'm going to show the illustration of this. 9 00:00:48,250 --> 00:00:53,220 So I've got inside my text editor here. 10 00:00:53,220 --> 00:01:02,580 I've just added this line of code here so I've created a constant here called birth year and that's 11 00:01:02,610 --> 00:01:09,060 set down to 1980 and then I got a variable called H. 12 00:01:09,240 --> 00:01:20,900 And I've said that to 20 17 miners both here which is this constant constant logging the result. 13 00:01:20,900 --> 00:01:25,210 So inside the console don't lock up passing it the H. 14 00:01:25,380 --> 00:01:27,410 Which is this variable. 15 00:01:27,630 --> 00:01:37,800 Now what that would do it would take away this subtract 1980 from 2017 and it all output the result. 16 00:01:37,950 --> 00:01:41,460 So let me try and save that. 17 00:01:41,620 --> 00:01:48,370 Let's run run the code inside our text editor and see what happens. 18 00:01:48,960 --> 00:01:54,300 So just click takes it refresh. 19 00:01:54,660 --> 00:02:00,990 So you can see here is given me an output of thirty seven. 20 00:02:00,990 --> 00:02:06,000 So the calculation is working as expected. 21 00:02:06,360 --> 00:02:11,820 So fine go ahead and see create not a variable. 22 00:02:12,070 --> 00:02:16,720 So if I come here I create a variable variable. 23 00:02:16,790 --> 00:02:22,290 We divide key word and I'm going to call it birth year as well. 24 00:02:22,290 --> 00:02:23,910 Same as a constant 25 00:02:26,670 --> 00:02:27,880 column. 26 00:02:28,790 --> 00:02:33,450 I am not going to set base to a different year so I make this. 27 00:02:33,570 --> 00:02:35,200 19. 28 00:02:35,970 --> 00:02:37,400 19. 29 00:02:37,950 --> 00:02:39,960 Oh right. 30 00:02:40,010 --> 00:02:49,410 So I said that if I run the code again I expect it not to work because I've already got a constant variable 31 00:02:49,410 --> 00:02:51,410 for that so that should not change. 32 00:02:51,540 --> 00:02:55,640 So here I am to defining it a game here. 33 00:02:55,860 --> 00:03:00,100 So let me run and run the code so you can see how that works. 34 00:03:00,690 --> 00:03:09,450 So fine you can see here get getting errors here because I have reassigned a constant variable so with 35 00:03:09,450 --> 00:03:14,680 constant variables that you are not supposed to read assigned. 36 00:03:14,870 --> 00:03:20,090 Alright so I've already got a valley here for berthier and I've created another one here. 37 00:03:20,100 --> 00:03:23,720 Hence my code is give in an error. 38 00:03:23,820 --> 00:03:36,210 I'm just going to comment not line out and get rid of that now and save that refresh to code the code 39 00:03:36,210 --> 00:03:42,940 shoot let memory back refresh. 40 00:03:43,100 --> 00:03:47,530 You can say is outputting correctly now so we can t key thing to take away. 41 00:03:47,530 --> 00:03:51,930 Here we use constants to declare your variables. 42 00:03:51,930 --> 00:03:53,180 They will be the variables. 43 00:03:53,190 --> 00:03:56,750 You don't expect to change or you don't expect to read a sign. 44 00:03:57,180 --> 00:03:57,990 Right. 45 00:03:58,010 --> 00:03:58,740 So that's it. 46 00:03:58,740 --> 00:04:00,680 Thanks for watching my friend.